package fx.iog.feed;

import java.util.ArrayList;
import java.util.List;

import fx.iog.gen.R;
import android.annotation.SuppressLint;
import android.app.Fragment;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;

@SuppressLint("NewApi")
public class FragmentFeedLocal extends Fragment {
	
	private CheckBox cb_feed_boate;
	private CheckBox cb_feed_lounge;
	private CheckBox cb_feed_restaurante;
	private CheckBox cb_feed_bistro;
	private CheckBox cb_feed_club;
	private CheckBox cb_feed_cabaret;
	private CheckBox cb_feed_bar;
	private CheckBox cb_feed_show;
	private Button btn_continuar;
	private static CheckBox ch_feed_tudo_local;
	private static List<CheckBox> listaLocal = new ArrayList<CheckBox>();
	
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
	super.onCreateView(inflater, container, savedInstanceState);
		
		View view = inflater.inflate(R.layout.fragment_selectfeed_local, container, false);
		Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/lucidacaligraph.TTF");
		
		cb_feed_boate = (CheckBox) view.findViewById(R.id.ch_feed_boate);
		cb_feed_lounge = (CheckBox) view.findViewById(R.id.ch_feed_lounge);
		cb_feed_restaurante = (CheckBox) view.findViewById(R.id.ch_feed_restaurante);
		cb_feed_bistro = (CheckBox) view.findViewById(R.id.ch_feed_bistro);
		cb_feed_club = (CheckBox) view.findViewById(R.id.cb_feed_club);
		cb_feed_bar = (CheckBox) view.findViewById(R.id.ch_feed_bar);
		cb_feed_show = (CheckBox) view.findViewById(R.id.ch_feed_show);
		ch_feed_tudo_local = (CheckBox) view.findViewById(R.id.ch_feed_tudo);
		cb_feed_cabaret = (CheckBox) view.findViewById(R.id.ch_feed_cabaret);
		btn_continuar = (Button) view.findViewById(R.id.btn_continuar_feed);
		
		btn_continuar.setTypeface(font);
		
		listaLocal.add(cb_feed_boate);
		listaLocal.add(cb_feed_lounge);
		listaLocal.add(cb_feed_restaurante);
		listaLocal.add(cb_feed_bistro);
		listaLocal.add(cb_feed_club);
		listaLocal.add(cb_feed_bar);
		listaLocal.add(cb_feed_show);
		listaLocal.add(cb_feed_cabaret);
		//listaLocal.add(ch_feed_tudo_local);
		
		return view;
	}
	
	public static void marcarTodos() {
		if(ch_feed_tudo_local.isChecked()) {
			for(int i = 0; i < listaLocal.size(); i++) {
				listaLocal.get(i).setChecked(true);
			}
		
		} else {
			for(int i = 0; i < listaLocal.size(); i++) {
				listaLocal.get(i).setChecked(false);
			}
			
		}
	}
}
